package com.bw.finance.conf;

import org.springframework.amqp.core.Binding;
import org.springframework.amqp.core.BindingBuilder;
import org.springframework.amqp.core.DirectExchange;
import org.springframework.amqp.core.Queue;
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration;

@Configuration
public class OrderMqConfig {

    public static final String EX_SECKILL="ex_seckill";

    public static final String QUEUE_ORDER="queue_order";

    public static final String RK_ORDER="rk_order";
    @Bean
    public DirectExchange exSeckill(){
        return new DirectExchange(EX_SECKILL);
    }

    @Bean
    public Queue queueorder(){
        return new Queue(QUEUE_ORDER);
    }

    @Bean
    public Binding bindExQueue(DirectExchange exSeckill,Queue queueorder){
       return BindingBuilder.bind(queueorder).to(exSeckill).with(RK_ORDER);
    }
}
